package zhongbo.java.air.flightpath.listener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.connection.MessageListener;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class RedisSubscribeLogChannelListener implements MessageListener {
    // 订阅消息，处理接收到的消息
    @Override
    public void onMessage(Message message, byte[] pattern) {
//        log.info("收到消息");
        String channel = new String(message.getChannel());
        String msgBody = new String(message.getBody());
        log.info("收到频道【{}】的消息: 【{}】", channel, msgBody);
    }
}
